package com.hzcx.app.simplechat.ui.moment.adapter;

import android.view.View;

import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hzcx.app.simplechat.R;
import com.hzcx.app.simplechat.ui.moment.bean.MomentCommentBean;
import com.hzcx.app.simplechat.util.glide.GlideUtils;

import java.util.List;

public class MomentCommentAdapter extends BaseQuickAdapter<MomentCommentBean, BaseViewHolder> {
    public MomentCommentAdapter(@Nullable List<MomentCommentBean> data) {
        super(R.layout.rv_item_moment_info_comment,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MomentCommentBean item) {
        GlideUtils.loadImg(mContext,item.getAvatar(),helper.getView(R.id.iv_head));
        helper.setText(R.id.tv_nick_name,item.getNickname());
        helper.setText(R.id.tv_date,item.getCreatetime());
        helper.setText(R.id.tv_content,item.getReview_content());
        ConstraintLayout consComment=helper.getView(R.id.cons_comment);
        if(item.getBy_review_data()==null){
            consComment.setVisibility(View.GONE);
        }else {
            consComment.setVisibility(View.VISIBLE);
            helper.setText(R.id.tv_comment_nick_name,item.getBy_review_data().getBy_nickname()+"：");
            helper.setText(R.id.tv_comment_content,item.getBy_review_data().getBy_review_content());
        }

        helper.addOnClickListener(R.id.iv_more);
    }
}
